﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RoslynEval
{
    public class EvalSystem
    {
        public Eval[] evals;

        public EvalSystem(String[] equations, String[] variableNames)
        {
            evals = Functional.Maps.Map(equations, x => new Eval(x, variableNames));
        }

        public Double[] CallAssemblies(Double[] variableValues)
        {
            return Functional.Maps.Map(evals, x => x.CallAssembly(variableValues));
        }

        public static Func<Double[], Double[]> CreateEvalSystemFunction(String[] inEquations, String[] variableNames)
        {
            EvalSystem evalSystem = new EvalSystem(inEquations, variableNames);
            return (Double[] variableValues) => evalSystem.CallAssemblies(variableValues);
        }

    }
}
